<template>
  <div class="HomePge">
    <div class="HomeTopBox">
      <h4 class="homeTitle">首页</h4>
      <div class="imgBox">
        <van-swipe :autoplay="3000">
          <van-swipe-item v-for="(image, index) in swiperList" :key="index">
            <img v-lazy="image.img" />
          </van-swipe-item>
        </van-swipe>
      </div>
    </div>
    <div class="mainBox">
      <div class="topCon">
        <div class="line"></div>
        <div class="word">DUJIANGYAN</div>
      </div>
      <div class="middleCon">
        <div class="item" v-for="(item, index) in titleList"
             :key="index"
             @click="jumpPage(item)"
             :style="{backgroundColor: item.bgColor}">
          <div></div>
          <div class="title">{{item.label}}</div>
          <img src="@/assets/home/like.png" class="like"/>
          <div class="line"></div>
          <div class="number">{{item.number}}</div>
        </div>
      </div>
      <div class="bottomCon">
        <div class="item" v-for="(item, index) in titles" :key="index" @click="jumpPage(item)">
          <div class="img">
            <img src="https://ww1.sinaimg.cn/large/663d3650gy1fq66vw50iwj20ff0aaaci.jpg"/>
          </div>
          <div class="top">
            <div class="name">{{item.name}}</div>
            <img src="@/assets/home/like1.png" class="like"/>
            <div class="clear"></div>
          </div>
          <div class="bottom">
            <div class="name">{{item.englishName}}</div>
            <div class="number">160</div>
            <div class="clear"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomePage',
  data () {
    return {
      swiperList: [{
        url: 'javascript:',
        img: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vvsr72j20p00gogo2.jpg'
      }, {
        url: 'javascript:',
        img: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vw1k2wj20p00goq7n.jpg'
      }, {
        url: 'javascript:',
        img: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vw50iwj20ff0aaaci.jpg',
        fallbackImg: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vw50iwj20ff0aaaci.jpg'
      }],
      titleList: [{
        label: '青城风光',
        number: 101,
        bgColor: '#b5dae3',
        pathUrl: '/IndexPage'
      }, {
        label: '美丽乡村',
        number: 102,
        bgColor: '#fbdee8',
        pathUrl: '/CountryPage'
      }],
      titles: [{
        name: '多彩青城',
        englishName: 'COLORFUL QINGCHENG',
        pathUrl: '/ColorfulPage'
      }, {
        name: '青城养生',
        englishName: 'QINGCHENG HEALTH',
        pathUrl: '/HealthPage'
      }, {
        name: '特产直达',
        englishName: 'SPECIAL LOCAL PRODUCT',
        pathUrl: '/DirectProduct'
      }, {
        name: '青城攻略',
        englishName: 'TRAVEL PRODUCT',
        pathUrl: '/StrategyIndex'
      }]
    }
  },
  methods: {
    jumpPage (obj) {
      this.$router.push({
        path: obj.pathUrl
      })
    }
  }
}
</script>

<style scoped lang="scss">
.HomePge{
  width: 100%;
  height: auto;
  min-height: calc(100vh);
  background: #ddd;
  padding-bottom: 1px;
  .clear {
    clear: both;
  }
  .HomeTopBox{
    width: 750px;
    height: 253px;
    padding-top: 125px;
    background-image: linear-gradient(0deg, rgba(131, 188, 255, 0.91) 0%, rgba(115, 153, 244, 0.91) 100%),
    linear-gradient(#e9e9e9, #e9e9e9);
    background-blend-mode: normal, normal;
    h4{
      width: 60px;
      font-size: 25px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 2.5px;
      color: #fff;
      margin: 17px auto;
      padding: 10px 0;
      text-align: center;
      border-bottom: 3px solid #fff;
    }
    .imgBox{
      width: 702px;
      height: 330px;
      background-color: #5a5a5a;
      border-radius: 5px;
      margin: 10px auto;
      .van-swipe {
        cursor: pointer;
        &-item {
          line-height: 330px;
          img {
            width: 100%;
            height: 330px;
            display: block;
            padding: 0;
            box-sizing: border-box;
            pointer-events: none;
            border-radius: 5px;
          }
          &:nth-child(even) {
            background-color: #39a9ed;
          }
          &:nth-child(odd) {
            background-color: #66c6f2;
          }
        }
      }
    }
  }
  .mainBox{
    width: 702px;
    background: #fff;
    border-radius: 5px;
    margin: 200px auto;
    .topCon {
      padding-top: 7px;
      display: flex;
      align-items: flex-start;
      .line {
        height: 24px;
        width: 7px;
        background: #b5dae3;
        margin-right: 7px;
      }
      .word {
        width: 122px;
        height: 14px;
        font-family: ArialMT;
        font-size: 16.7px;
        font-weight: normal;
        font-stretch: normal;
        letter-spacing: 1.3px;
        color: #b5dae3;
      }
    }
    .middleCon {
      color: #fff;
      height: auto;
      margin: 10px;
      display: flex;
      justify-content: center;
      .item {
        width: 330px;
        height: 70px;
        background-color: #b5dae3;
        border-radius: 5px;
        margin-left: 12px;
        position: relative;
        font-family: SourceHanSansCN-Regular;
        div, img {
          position: absolute;
        }
        .title {
          font-size: 22px;
          font-weight: normal;
          font-stretch: normal;
          letter-spacing: 1.7px;
          top: 10px;
          left: 20px;
        }
        .like {
          width: 22px;
          height: 20px;
          top: 10px;
          right: 20px;
        }
        .line {
          width: 21px;
          height: 2px;
          background: #fff;
          left: 20px;
          bottom: 10px;
        }
        .number {
          font-size: 16px;
          font-weight: normal;
          font-stretch: normal;
          letter-spacing: 0.9px;
          right: 15px;
          bottom: 4px;
        }
      }
    }
    .bottomCon {
      margin: 20px auto 20px 20px;
      .item {
        width: 330px;
        display: inline-block;
        .img {
          width: 100%;
          height: 256px;
          background-color: #b5dae3;
          img {
            width: 100%;
            height: 100%;
            border-radius: 5px;
          }
        }
        .top, .bottom {
          padding: 0 5px;
          margin-top: 11px;
        }
        .top {
          img {
            width: 21px;
            height: 19px;
          }
        }
        .top .name, .bottom .name {
          float: left;
          font-family: SourceHanSansCN-Regular;
          font-size: 14.3px;
          font-weight: normal;
          font-stretch: normal;
          letter-spacing: 1.1px;
          color: #010101;
        }
        .top .like, .bottom .number {
          float: right;
        }
        .bottom {
          .number {
            color: #b5dae3;
          }
        }
      }
      .item:nth-child(odd) {
        margin-right: 10px;
      }
    }
  }
}
</style>
